package com.smart.home.controller.Home;

import com.smart.home.result.Result;
import com.smart.home.service.HomeMemberService;
import com.smart.home.vo.HomeMembersVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@Api(tags = "家庭管理模板")
@RequestMapping("/homeMember")
public class HomeMembersController {
    //返回相关id的用户所有家庭用户详细信息
    @Autowired
    private HomeMemberService homeMemberService;

    /**
     * 返回相关id的用户所有家庭用户详细信息
     * @param HomeId
     * @return
     */
    @GetMapping("/get/{id}")
    @ApiOperation("返回相关id的用户所有家庭用户详细信息")
    public Result<List<HomeMembersVO>> queryHomeMemberInfo(@PathVariable("id")  Long HomeId){
        log.info("返回信息的家庭ID:{}",HomeId);
        List<HomeMembersVO> homeMembersVOs = homeMemberService.queryHomeMemberInfo(HomeId);
        return Result.success(homeMembersVOs);
    }




}
